<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>分类管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-form" lay-filter="LAY-app-course-category-form" id="LAY-app-course-category-form">
    <div class="layui-form-item">
        <label class="layui-form-label">上级分类</label>
        <div class="layui-input-inline">
            <script id="tpl_parent_id" type="text/html" template lay-url="{{ layui.setter.host }}/course_category" lay-done="layui.form.render('select');">
                <select name="parent_id" lay-verify="required" lay-search="">
                    <option value="0">顶级分类</option>
                    {{# layui.each(d.data, function(index, item){ }}
                    <option value="{{item.id}}" {{ d.params.parent_id === item.id ? 'selected' : '' }}>{{item.name}}</option>
                    {{# }); }}
                </select>
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分类名称</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="name" value="{{ d.params.name || '' }}" lay-verify="required" placeholder="请输入..." autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分类图标</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="icon" value="{{ d.params.icon || '' }}"
                       placeholder="请选择图片" autocomplete="off" class="layui-input">
            </script>
        </div>
        <button style="float: left;" type="button" class="layui-btn" layadmin-event="select_image">选择图片</button>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="number" name="sort" value="{{ d.params.sort || 0 }}" lay-verify="required" placeholder="请输入..." autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <select name="status" lay-verify="required">
                    <option value="1" {{ d.params.status == '1' ? 'selected' : '' }}>启用</option>
                    <option value="0" {{ d.params.status == '0' ? 'selected' : '' }}>禁用</option>
                </select>
            </script>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-app-course-category-submit" id="LAY-user-front-submit" value="确认">
    </div>
</div>

<script src="/static/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$
            , form = layui.form;
    })
</script>
</body>
</html>